package com.example.demo.service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.example.demo.entity.Husband;
import com.example.demo.repository.HusbandRepository;

@Service
public class HusbandService {

	@Resource
	private HusbandRepository husbandRepository;
	
	@Transactional
	public Husband addHusband(Husband hasband) {
		return husbandRepository.save(hasband);
	}

	public Object getById(Integer id) {
		Husband hus = husbandRepository.findOne(id);
		hus.getWife();
		return hus;
	}
}
